//数的划分
//非递归式回溯
#include <iostream> 
using namespace std;
const int MAXN=200;
const int MAXK=6;
int s[MAXK+1];
int n,k;
int rest,total;

int main()
{
    cin>>n>>k;
    total=0;s[1]=0;
    rest=n;
    int i=1;
    while(i){
        s[i]++;
        if (s[i]>rest) {
            i--;
            rest+=s[i];
        }
        else {
            if (i==k){
                if (s[i]==rest) total++;
            }else {
                rest-=s[i];
                i++;
                s[i]=s[i-1]-1;
            }
        }
    }
    cout<<total;
} 
